<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('trip_order_passenger_costs', function (Blueprint $table) {
            $table->id();
            $table->uuid('user_id')->comment('用户id');
            $table->string('trip_id')->comment('行程业务id');
            $table->integer('trip_type')->default(0)->comment('出行类型 1火车 2飞机 3 酒店');
            $table->string('order_sn')->comment('订单单号');
            $table->string('passenger_id')->comment('订单单号');
            $table->string('sequence')->default(1)->comment('乘客序号 id_序号=子id');
            $table->tinyInteger('type')->comment('如:车票,保险费,购票手续费,维语用语言包,提示信息写到配置文件');
            $table->decimal('price')->comment('费用单价');
            $table->string('name')->comment('收费项如 疫情隔离补贴,指定车厢.指定铺席,维语用语言包');
            $table->string('detail', 50)->default('')->comment('如 二等座，险种，指定的铺席坐席内容等 ');
            $table->string('pay_sn', 32)->default('')->comment('支付单号');
            $table->integer('parent_type')->default(0)->comment('父类型 可能与子类型一致');

            $table->timestamps();
            $table->index(['order_sn', 'passenger_id', 'user_id'], 'idx_order_passenger_user');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('trip_order_passenger_costs');
    }
};
